package com.xlf.service.judge.strategy.judgeProblemMode.content;

import com.xlf.pojo.base.Judge;
import com.xlf.pojo.base.JudgeCase;
import com.xlf.pojo.base.Problem;
import com.xlf.service.judge.strategy.judgeProblemMode.AbstractJudgeProblemModeStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author xlf 2734029211@qq.com
 * @Date 2023/9/21 15:21
 * @Description: TODO
 * @Version 1.0
 */
@Service
public class JudgeProblemModeContent {

    @Autowired
    AbstractJudgeProblemModeStrategy abstractJudgeProblemModeStrategy;


    /**
     * 判题，判题结果会回写到参数
     * @param problem
     * @param judge
     * @param judgeCases
     */
    public void Judge(Problem problem, Judge judge, List<JudgeCase> judgeCases) {
        abstractJudgeProblemModeStrategy.Judge(problem,judge,judgeCases);
    }

    /**
     * 测试用例比较
     * @param userOutput 用户输出
     * @param isRemoveEOLBlank 是否去除首位空格
     * @param testcase 期望输出
     * @return
     */
    public Integer testJudge(String userOutput, Integer isRemoveEOLBlank, String testcase){
        return abstractJudgeProblemModeStrategy.TestJudge(userOutput, isRemoveEOLBlank, testcase);
    }

}
